package com.jlf.tool.validation;


import com.jlf.tool.validation.constraint.InNumberConstraintValidator;
import jakarta.validation.Constraint;
import jakarta.validation.Payload;

import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;

import static java.lang.annotation.ElementType.*;
import static java.lang.annotation.RetentionPolicy.RUNTIME;

/**
 * 判断数据是否在数值范围之内
 *
 * @author wujr
 * 2021/8/27
 * @version 1.0
 * 变更历史
 * [wujr 2021/8/27 1.0 新增]
 */
@Documented
@Constraint(validatedBy = {InNumberConstraintValidator.class})
@Target({ METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER, TYPE_USE })
@Retention(RUNTIME)
public @interface InNumber {
    /**
     * 取值范围
     * @return 范围数组
     */
    long[] value();

    String message() default "{javax.validation.constraints.InNumber.message}";
    Class<?>[] groups() default { };

    Class<? extends Payload>[] payload() default { };
}
